'use strict';

const Controller = require('egg').Controller;

class whjregister extends Controller {
  async index() {
    const data = await this.ctx.service.whjregister.findAll(this.ctx);
    this.ctx.body = data;
  }
  async create() {
    const ctx = this.ctx;
    const params = ctx.request.body;
    const data = await ctx.service.whjregister.create(params);
    ctx.body = data;
  }
  async destroy() {
    const ctx = this.ctx;
    const whjregisterId = ctx.params.id;
    const del = await ctx.service.whjregister.delete(whjregisterId);
    ctx.body = del;
  }
  async update() {
    const ctx = this.ctx;
    const whjregisterId = ctx.params.id;
    const params = ctx.request.body;
    const change = await ctx.service.whjregister.update(whjregisterId, params);
    ctx.body = change;
  }
  async show() {
    const ctx = this.ctx;
    const id = ctx.params.id;
    const whjregister = await this.ctx.service.whjregister.find(id);
    ctx.body = whjregister;
  }
  async index0() {
    const ctx = this.ctx;
    const username = ctx.params.username;
    console.log(username);
    const data = await this.ctx.service.whjregister.findAll0(username);
    this.ctx.body = data;
  }

}
module.exports = whjregister;
